package com.wangyf.thread.c_000_whatisthread;

/**
 * 创建线程的3种方式
 * @author wangyf
 * @date 2021/1/1 11:32
 */
public class T02_HowToCreateThread {
    private static class MyThread extends Thread{
        @Override
        public void run() {
            System.out.println("extends Thread");
        }
    }
    private static class MyRunnable implements Runnable {
        public void run() {
            System.out.println("implements Runnable");
        }
    }
    public static void main(String[] args) {
        // 继承 运行
        new MyThread().start();
        // 实现 运行Thread
        new Thread(new MyRunnable()).start();
        // lambda 或者线程池
        new Thread(() -> System.out.println("lambda start")).start();
    }
}
